﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;

namespace PeopleTV
{
    public class TV
    {

        public TV()
        {
            Console.WriteLine("Turn on the TV");
            ChanelOfTV = 2;
            LevelOfVolume = 12;
            // Create a timer with a ten second interval.
            var aTimer = new System.Timers.Timer(10000);

            // Hook up the Elapsed event for the timer.
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

            aTimer.Enabled = true;
        }
 
        public void PressPower()
        {
            IsPowered = true;
            Console.WriteLine("TV is enabled");
        }

        public void PressButtonOfChannelUp()
        {
            if (IsPowered)
            {
                ChanelOfTV++;
                Console.WriteLine("Channel number {0}",ChanelOfTV);
            }
            else
            {
                Console.WriteLine("Turn on the TV");
            }
          
        }
        public void PressButtonOfChannelDown()
        {
            if (IsPowered)
            {
                ChanelOfTV--;
                Console.WriteLine("Channel number {0}", ChanelOfTV);
            }
            
        }
        

        public void PressButtonOfVolumeUp()
        {
            if (IsPowered)
            {
                LevelOfVolume++;
                Console.WriteLine("Volume is {0}", LevelOfVolume);
            }
                
        }
        public void PressButtonOfVolumeDown()
        {
            if (IsPowered)
            {
                LevelOfVolume--;
                Console.WriteLine("Volume is {0}", LevelOfVolume);
            }
          
        }

        private void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            Console.WriteLine("TV is off");
            IsPowered = false;
        }

        public bool IsPowered { get; set; }
        public int ChanelOfTV { get; set; }
        public int LevelOfVolume { get; set; }

    }
}
